package ru.vsu.cs.kis.elections.client;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ElectionMain implements LocalConsts {

	public static void main(String[] args) {
		ExecutorService service=Executors.newCachedThreadPool();		
		ClientThread thr=new ClientThread("vrn45", "pw33", "127.0.0.1", 4444);
		service.submit(thr);
		
		//ClientController cl = ClientController.initClient();

		//cl.addSoscketClients(1);
		
		/*
		Scanner sc = new Scanner(System.in);
		String command;
		while (true) {
			System.out.println("enter command");
			command = sc.nextLine();
			if (command.startsWith(ADD_CLIENTS)) {
				cl.addSoscketClients(getCount(command));
			} else if (command.equals(REMOVE_CLIENTS)) {
				cl.removeSocketClients(getCount(command));
			} else if (command.startsWith(SET_PING)) {
				cl.setPing(getCount(command));
			} else if (command.startsWith(SET_SOCKET_CLIENTS)) {
				cl.setSocketclients(getCount(command));
			} else if (command.equals(GET_STAT)) {
				cl.getStatistics();
			} else {
				System.out.println("command doesn't support");
			}
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}*/
		
		
	}
	
	private static int getCount(String command){
		return Integer.parseInt(command.subSequence(command.length() -
				 ADD_CLIENTS.length(), command.length()).toString());
	}

	public static void printResult(String okString, String errMes, Integer result) {
		if (result != null){
			System.out.println(result + okString);
		} else {
			System.out.println(errMes);
		}
	}
}
